package models

type DockerRepo struct {
	Model
	Name          string `gorm:"column:name" json:"name" form:"name"`
	Description   string `gorm:"column:description" json:"description" form:"description"`
	Host          string `gorm:"column:host" json:"host" form:"host"`
	PushAddress   string `gorm:"column:push_address" json:"push_address" form:"push_address"`
	CredentialsId string `gorm:"column:credentials_id" json:"credentials_id" form:"credentials_id"`
	WebProtocol   string `gorm:"column:web_protocol" json:"web_protocol" form:"web_protocol"`
}

func GetDockerRepoByID(id int) DockerRepo {
	repo := DockerRepo{}
	db.Where("deleted_at = ?", 0).Where("id = ?", id).First(&repo)
	return repo
}

func GetDockerRepos() []DockerRepo {
	repos := make([]DockerRepo, 0)
	db.Where("deleted_at = ?", 0).Find(&repos)
	return repos
}
